home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / datamgr / dataform.frm next >
Text File  |  1993-04-20  |  19KB  |  729 lines

  1. VERSION 2.00
  2. Begin Form DataForm 
  3.    BackColor       =   &H00C0C0C0&
  4.    ClientHeight    =   3960
  5.    ClientLeft      =   630
  6.    ClientTop       =   1755
  7.    ClientWidth     =   8475
  8.    Height          =   4365
  9.    Icon            =   DATAFORM.FRX:0000
  10.    Left            =   570
  11.    LinkTopic       =   "Form2"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   3960
  14.    ScaleWidth      =   8475
  15.    Top             =   1410
  16.    Width           =   8595
  17.    Begin PictureBox StatBox 
  18.       Align           =   2  'Align Bottom
  19.       BackColor       =   &H00C0C0C0&
  20.       BorderStyle     =   0  'None
  21.       Height          =   270
  22.       Left            =   0
  23.       ScaleHeight     =   282.462
  24.       ScaleMode       =   0  'User
  25.       ScaleWidth      =   8490.27
  26.       TabIndex        =   5
  27.       Top             =   3690
  28.       Width           =   8475
  29.       Begin Data Data1 
  30.          Connect         =   ""
  31.          DatabaseName    =   ""
  32.          Exclusive       =   0   'False
  33.          Height          =   270
  34.          Left            =   0
  35.          Options         =   0
  36.          ReadOnly        =   0   'False
  37.          RecordSource    =   ""
  38.          Top             =   0
  39.          Width           =   5475
  40.       End
  41.    End
  42.    Begin VScrollBar cScrollBar 
  43.       Height          =   2085
  44.       LargeChange     =   3500
  45.       Left            =   7665
  46.       SmallChange     =   350
  47.       TabIndex        =   14
  48.       Top             =   630
  49.       Visible         =   0   'False
  50.       Width           =   255
  51.    End
  52.    Begin PictureBox cFields 
  53.       BackColor       =   &H00C0C0C0&
  54.       BorderStyle     =   0  'None
  55.       Height          =   1065
  56.       Left            =   0
  57.       ScaleHeight     =   1056.48
  58.       ScaleMode       =   0  'User
  59.       ScaleWidth      =   7600.262
  60.       TabIndex        =   9
  61.       TabStop         =   0   'False
  62.       Top             =   630
  63.       Width           =   7605
  64.       Begin TextBox cFieldData 
  65.          BackColor       =   &H00FFFFFF&
  66.          DataSource      =   "Data1"
  67.          ForeColor       =   &H00000000&
  68.          Height          =   285
  69.          Index           =   0
  70.          Left            =   1679
  71.          TabIndex        =   12
  72.          Top             =   0
  73.          Visible         =   0   'False
  74.          Width           =   3255
  75.       End
  76.       Begin CheckBox cFieldCheck 
  77.          BackColor       =   &H00C0C0C0&
  78.          DataSource      =   "Data1"
  79.          Height          =   330
  80.          Index           =   0
  81.          Left            =   1679
  82.          TabIndex        =   11
  83.          Top             =   735
  84.          Visible         =   0   'False
  85.          Width           =   3270
  86.       End
  87.       Begin PictureBox cFieldPicture 
  88.          DataSource      =   "Data1"
  89.          Height          =   282
  90.          Index           =   0
  91.          Left            =   1679
  92.          ScaleHeight     =   255
  93.          ScaleWidth      =   3240
  94.          TabIndex        =   10
  95.          Top             =   315
  96.          Visible         =   0   'False
  97.          Width           =   3270
  98.       End
  99.       Begin Label cFieldName 
  100.          BackColor       =   &H00C0C0C0&
  101.          ForeColor       =   &H00000000&
  102.          Height          =   225
  103.          Index           =   0
  104.          Left            =   105
  105.          TabIndex        =   13
  106.          Top             =   0
  107.          Visible         =   0   'False
  108.          Width           =   1515
  109.       End
  110.    End
  111.    Begin PictureBox FieldHeader 
  112.       Align           =   1  'Align Top
  113.       BackColor       =   &H00C0C0C0&
  114.       BorderStyle     =   0  'None
  115.       Height          =   300
  116.       Left            =   0
  117.       ScaleHeight     =   300
  118.       ScaleMode       =   0  'User
  119.       ScaleWidth      =   8480.059
  120.       TabIndex        =   6
  121.       Top             =   330
  122.       Width           =   8475
  123.       Begin Label FieldValueLabel 
  124.          BackColor       =   &H00C0C0C0&
  125.          Caption         =   " Value:"
  126.          Height          =   252
  127.          Left            =   1680
  128.          TabIndex        =   8
  129.          Top             =   30
  130.          Width           =   2652
  131.       End
  132.       Begin Label FieldHdrLabel 
  133.          BackColor       =   &H00C0C0C0&
  134.          Caption         =   "Field Name:"
  135.          Height          =   252
  136.          Left            =   120
  137.          TabIndex        =   7
  138.          Top             =   30
  139.          Width           =   1212
  140.       End
  141.    End
  142.    Begin PictureBox TopPic 
  143.       Align           =   1  'Align Top
  144.       BackColor       =   &H00C0C0C0&
  145.       BorderStyle     =   0  'None
  146.       Height          =   330
  147.       Left            =   0
  148.       ScaleHeight     =   330
  149.       ScaleWidth      =   8475
  150.       TabIndex        =   0
  151.       Top             =   0
  152.       Width           =   8475
  153.       Begin CommandButton RefreshBtn 
  154.          Caption         =   "&Refresh"
  155.          Height          =   260
  156.          Left            =   4680
  157.          TabIndex        =   15
  158.          Top             =   0
  159.          Width           =   1215
  160.       End
  161.       Begin CommandButton FindBtn 
  162.          Caption         =   "&Find"
  163.          Height          =   260
  164.          Left            =   3480
  165.          TabIndex        =   4
  166.          Top             =   0
  167.          Width           =   1215
  168.       End
  169.       Begin CommandButton DeleteBtn 
  170.          Caption         =   "&Delete"
  171.          Height          =   260
  172.          Left            =   2280
  173.          TabIndex        =   3
  174.          Top             =   0
  175.          Width           =   1215
  176.       End
  177.       Begin CommandButton AddBtn 
  178.          Caption         =   "&Add"
  179.          Height          =   260
  180.          Left            =   0
  181.          TabIndex        =   2
  182.          Top             =   0
  183.          Width           =   1215
  184.       End
  185.       Begin CommandButton UpdateBtn 
  186.          Caption         =   "&Update"
  187.          Height          =   260
  188.          Left            =   1200
  189.          TabIndex        =   1
  190.          Top             =   0
  191.          Width           =   1095
  192.       End
  193.    End
  194. End
  195. Dim FldArr() As control
  196.  
  197. Dim FDS As Dynaset
  198. Dim numFlds As Integer
  199. Dim CurrField As Integer
  200. Dim JustUsedFind As Integer        'flag for find function
  201. Dim fResizing As Integer           'flag to avoid resize recursion
  202.  
  203. Dim FldTop As Integer
  204.  
  205. Const EM_NOTHING = 0
  206. Const EM_EDIT = 1
  207. Const EM_ADDNEW = 2
  208.  
  209. Const FT_TRUEFALSE = 1
  210. Const FT_BYTE = 2
  211. Const FT_INTEGER = 3
  212. Const FT_LONG = 4
  213. Const FT_CURRENCY = 5
  214. Const FT_SINGLE = 6
  215. Const FT_DOUBLE = 7
  216. Const FT_DATETIME = 8
  217. Const FT_STRING = 10
  218. Const FT_BINARY = 11
  219. Const FT_MEMO = 12
  220.  
  221. Const YES = 6
  222. Const MSGBOX_TYPE = 4 + 48
  223.  
  224. Sub AddBtn_Click ()
  225.   On Error GoTo AddErr
  226.     
  227.     data1.Caption = "Entering New Record"
  228.   If AddBtn.Tag = "Disabled" Then
  229.     EnableAllControls
  230.   End If
  231.   data1.Recordset.AddNew
  232.   FldArr(0).SetFocus
  233.   Exit Sub
  234.  
  235. AddErr:
  236.   MsgBox Error$
  237.   Resume AddEnd
  238. AddEnd:
  239.  
  240. End Sub
  241.  
  242. Sub cFieldPicture_Click (Index As Integer)
  243.   'this toggles the size of a picture control
  244.   'so it mat be viewed or compressed
  245.   If cFieldPicture(Index).Height <= 280 Then
  246.     cFieldPicture(Index).AutoSize = True
  247.   Else
  248.     cFieldPicture(Index).AutoSize = False
  249.     cFieldPicture(Index).Height = 280
  250.   End If
  251. End Sub
  252.  
  253. Sub cFieldPicture_DblClick (Index As Integer)
  254.   On Error GoTo PicErr
  255.  
  256.   st = InputBox("Enter Picture FilName:")
  257.   If st <> "" Then
  258.     cFieldPicture(Index).Picture = LoadPicture(st)
  259.   End If
  260.  
  261.   GoTo PicEnd
  262.  
  263. PicErr:
  264.   MsgBox Error$
  265.   Resume PicEnd
  266.  
  267. PicEnd:
  268.  
  269. End Sub
  270.  
  271. Sub cScrollBar_Change ()
  272.   Dim t As Integer
  273.  
  274.   t = cScrollBar
  275.   If (t - FldTop) Mod 350 = 0 Then
  276.     cFields.Top = t
  277.   Else
  278.     cFields.Top = ((t - FldTop) \ 350) * 350 + FldTop
  279.   End If
  280.  
  281. End Sub
  282.  
  283. Sub Data1_Error (dataerr As Integer, response As Integer)
  284.   If dataerr = 3021 Then
  285.     response = 0
  286.   ElseIf dataerr = 481 Or dataerr = 321 Then 'Invalid picture
  287.     response = 0
  288.   Else
  289.     MsgBox "Error:  " + Error$(dataerr)
  290.     response = 0
  291.   End If
  292. End Sub
  293.  
  294. Sub data1_Reposition ()
  295.     'if n